<!DOCTYPE html>
<html>

<head th:include="_header_include::frag(~{::title},~{},~{})">
  <title>返款确认</title>
</head>

<body>
  <div id="maindiv" class="maindiv mainPadding" style="display: none;">
    <el-breadcrumb separator="/" class="elBreadcrumb marginB20">
      <el-breadcrumb-item>Home</el-breadcrumb-item>
      <el-breadcrumb-item>财务管理</el-breadcrumb-item>
      <el-breadcrumb-item>返款确认</el-breadcrumb-item>
    </el-breadcrumb>
    <el-row class="marginB20">
      <shiro:hasPermission name="aggregation:rebateConfirm:confirmRebate">
        <el-button type="primary" @click="openSign">返款确认</el-button>
      </shiro:hasPermission>
      <shiro:hasPermission name="aggregation:rebateConfirm:rejectRebate">
        <el-button type="success" @click="openRejectRefundDialog">驳回</el-button>
      </shiro:hasPermission>
      <shiro:hasPermission name="aggregation:rebateConfirm:markRebate">
        <el-button type="warning" @click="openMarkRefundDialog">标记已返款</el-button>
      </shiro:hasPermission>
      <shiro:hasPermission name="aggregation:rebateConfirm:export">
        <el-button  icon="el-icon-download"  type="warning" @click="exportMes">返款导出</el-button>
      </shiro:hasPermission>
    </el-row>
    <div class="mainSearchBg">
      <div class="mainSearchFormBox">
        <el-form :inline="true" class="demo-form-inline mainSearchForm" :model="form" ref="form">
          <el-form-item label="商务大区:">
            <el-select v-model="form.busAreaId" placeholder="商务大区" clearable @change="changeBusArea"
              @clear="clearBusAreaList">
              <el-option v-for="item in busAreaList" :key="item.id" :label="item.name" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="签单商务组:">
            <el-select v-model="form.busGroupId" placeholder="签单商务组" clearable @change="changeBusGroup"
              @clear="clearBusGroupList">
              <el-option v-for="item in busGroupList" :key="item.id" :label="item.name" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="签单商务经理:">
            <el-select v-model="form.busManagerId" placeholder="签单商务经理" clearable>
              <el-option v-for="item in busManagerList" :key="item.id" :label="item.name" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="返款时间:">
            <el-date-picker v-model="form.startTime" type="datetime" placeholder="选择日期时间">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="—" class="widthauto">
            <el-date-picker v-model="form.endTime" type="datetime" placeholder="选择日期时间">
            </el-date-picker>
          </el-form-item>
          <el-row v-show="isShow">
            <el-form-item label="签约店型:">
              <el-select v-model="form.signShopType" placeholder="签约店型" clearable>
                <el-option v-for="item in vistitStoreTypeArr" :key="item.value" :label="item.name" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="处理状态:">
              <el-select v-model="form.status" placeholder="处理状态" clearable>
                <el-option v-for="item in statusList" :key="item.value" :label="item.name" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="电销事业部:">
              <el-select v-model="form.teleDeptId" placeholder="电销事业部" clearable @change="changeTeleDept"
                @clear="clearTeleDeptList">
                <el-option v-for="item in teleDeptList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="电销组:">
              <el-select v-model="form.teleGroupId" placeholder="电销组" clearable @change="changeTeleGroup"
                @clear="clearTeleGroupList">
                <el-option v-for="item in teleGroupIdList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="电销顾问:">
              <el-select v-model="form.teleId" placeholder="电销顾问" clearable>
                <el-option v-for="item in teleIdList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="签约省份:">
              <el-select v-model="form.signProvince" placeholder="签约省份" clearable>
                <el-option v-for="item in proviceList" :key="item.id" :label="item.name" :value="item.name">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="签约类型:">
              <el-select v-model="form.signType" placeholder="签约类型" clearable>
                <el-option v-for="item in signTypeList" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="客户姓名:">
              <el-input v-model="form.customerName" placeholder="客户姓名"></el-input>
            </el-form-item>
            <el-form-item label="客户联系方式:">
              <el-input v-model="form.phone" placeholder="客户联系方式"></el-input>
            </el-form-item>
            <el-form-item label="签约单编号:">
              <el-input v-model="form.signNo" placeholder="签约单编号"></el-input>
            </el-form-item>
          </el-row>
          <div class="mainSearchBtnBox">
            <el-button icon="el-icon-search" type="primary" @click="searchTable()" class="searchBtn">搜索</el-button>
            <!-- <el-button type="info" class="searchBtn">取消</el-button> -->
            <span style="color: #5c6be8;cursor: pointer;margin:0 10px;" @click="toogleClick"><span
                v-if="isShow">收起</span><span v-else>展开更多</span><i
                :class="{'greycolor paddingL6 el-icon-arrow-up':isShow,'greycolor paddingL6 el-icon-arrow-down':!isShow}"></i></span>
          </div>
        </el-form>
      </div>
      <!-- 表格 -->
      <el-row>
        <el-table ref="tableData" tooltip-effect="dark" border :data="tableData"
          @selection-change="handleSelectionChange">
          <el-table-column align="center" type="selection"></el-table-column>
          <el-table-column align="center" type="index" label="序号" width="55"></el-table-column>
          <el-table-column align="center" prop="signNo" label="签约单编号"></el-table-column>
          <el-table-column align="center" prop="customerName" label="客户姓名"></el-table-column>
          <el-table-column align="center" prop="relateSignNoList" label="关联签约单">
            <template slot-scope="scope">
              <div v-if="scope.row.relateSignNoList.length>=1" v-for="item in scope.row.relateSignNoList">
                <el-button size="mini" type="text" @click="openSignDialog(item)">{{item}}</el-button>
              </div>
            </template>
            <!--    <template slot-scope="scope">
                        <div  v-if="scope.row.relateSignNoList.length>=1"   v-for="item in scope.row.relateSignNoList">
                            <el-button size="mini"  type="text" @click="toSignPage(item)">{{item}}</el-button>
                        </div>
                    </template> -->

          </el-table-column>
          <el-table-column align="center" prop="cusAmount" label="返款客户金额"></el-table-column>
          <el-table-column align="center" prop="bearAmount" label="承担金额"></el-table-column>
          <!--   <el-table-column align="center" prop="companyAmount" label="返换餐饮公司金额"></el-table-column> -->
          <el-table-column align="center" prop="refundTime" label="返款时间"></el-table-column>
          <el-table-column align="center" prop="" label="返款图片" width="100">
            <template slot-scope="scope">
              <!-- <el-button @click="download(scope.row)" size="small" type="text">下载图片</el-button> -->
              <p v-for="(item,index) in scope.row.images" style="margin-bottom:8px;">
                  <span @click="download(scope.row.images,index)" style="color:blue;text-decoration:underline;cursor: pointer;">{{item.realName}}</span>
              </p>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="reason" label="返款原因" width="100">
            <template slot-scope="scope">
              <el-button @click="showReason1(scope.row)" size="small" type="text">查看原因</el-button>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="applyTime" label="申请返款时间"></el-table-column>
          <el-table-column align="center" prop="status" label="处理状态">
            <template slot-scope="scope">
              <div v-if="scope.row.status == '2'">
                <span class="inlineText" style="color:red">已驳回</span>
                <el-button @click="showReason(scope.row)" size="small" type="text">驳回原因</el-button>
              </div>
              <div v-else-if="scope.row.status == '1'">返款确认中</div>
              <div v-else-if="scope.row.status == '3'">确认返款</div>
              <div v-else-if="scope.row.status == '4'">已返款</div>
              <div v-else-if="scope.row.status == '5'">标记返款结束</div>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="signProjectName" label="签约项目"></el-table-column>
          <el-table-column align="center" prop="signType" label="签约类型" width="100">
            <template slot-scope="scope">
              <div v-if="scope.row.signType == '1'">一次性全款</div>
              <div v-else-if="scope.row.signType == '2'">先付定金</div>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="signTime" label="签约时间"></el-table-column>
          <el-table-column align="center" prop="" label="付款明细" width="100">
            <!-- <template slot-scope="scope">
                        <el-button @click="showDetail(scope.row)" type="text">查看明细</el-button>
                    </template> -->
            <template slot-scope="scope">
              <el-button type="text" size="small" @click="recordClick(scope.row)">查看明细
              </el-button>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="signShopTypeName" label="签约店型" width="100"></el-table-column>
          <el-table-column align="center" prop="amountReceivable" label="合同应收金额"></el-table-column>
          <!--<el-table-column align="center" prop="firstToll" label="路费"></el-table-column>-->
          <!--<el-table-column align="center" prop="preferentialAmount" label="优惠金额"></el-table-column>-->
          <!--<el-table-column align="center" prop="giveAmount" label="赠送金额"></el-table-column>-->
          <el-table-column align="center" prop="idCard" label="客户身份证号"></el-table-column>
          <el-table-column align="center" prop="phone" label="手机号"></el-table-column>
          <el-table-column align="center" prop="signProvince" label="签约省份" width="110"></el-table-column>
          <el-table-column align="center" prop="signCity" label="签约城市" width="120"></el-table-column>
          <el-table-column align="center" prop="signDictrict" label="签约区／县" width="130"></el-table-column>
          <el-table-column align="center" prop="busAreaName" label="商务大区"></el-table-column>
          <el-table-column align="center" prop="busGroupName" label="商务小组"></el-table-column>
          <el-table-column align="center" prop="busManagerName" label="商务经理"></el-table-column>
          <el-table-column align="center" prop="teleCompanyName" label="电销分公司"></el-table-column>
          <el-table-column align="center" prop="teleDeptName" label="电销事业部"></el-table-column>
          <el-table-column align="center" prop="teleGroupName" label="电销组"></el-table-column>
          <el-table-column align="center" prop="teleSaleName" label="电销顾问"></el-table-column>
          <el-table-column align="center" prop="isRemoteSign" label="是否远程签约" :formatter="getIsRemoteSign" width="120">
          </el-table-column>
        </el-table>
        <table-pagination v-if="paginationShow" :pager="pager" @change="searchTable"></table-pagination>
      </el-row>
    </div>
    <!-- 驳回编辑 -->
    <el-dialog :title="editRejectTitle" :visible.sync="dialogFormVisible" width="870px" v-dialog-drag>
      <el-form :model="dialogForm" ref="dialogForm" :rules="dialogRules">
        <el-form-item label="驳回人员：" :label-width="formLabelWidth" prop="person">
          {{dialogForm.auditUserName}}
        </el-form-item>
        <el-form-item label="驳回时间：" :label-width="formLabelWidth" prop="rejectTime">
          {{dialogForm.rejectTime}}
        </el-form-item>
        <el-form-item label="驳回原因：" :label-width="formLabelWidth" prop="reason" class="redcolor">
          {{dialogForm.rejectReason}}
        </el-form-item>
        <el-form-item label="返款客户金额：" :label-width="formLabelWidth" prop="cusAmount">
          <el-input @input="allCalAmount" v-model="dialogForm.cusAmount" placeholder="" style="width:50%"
            maxlength="10"></el-input>
        </el-form-item>

        <el-form-item prop="settingStatus" label="" :label-width="formLabelWidth">
          <div v-if="dialogForm.settingStatus == 1">
            当前项目为给品牌商结算
          </div>

        </el-form-item>
        <el-form-item label="承担金额：" :label-width="formLabelWidth" prop="bearAmount">
          <el-input v-model="dialogForm.bearAmount" maxlength="10" @keyup.native="number" placeholder=""
            style="width:290px"></el-input>
        </el-form-item>
        <el-form-item label="返款时间：" :label-width="formLabelWidth" prop="refundTime">
          <el-date-picker style="width: 50%;" v-model="dialogForm.refundTime" type="datetime" placeholder="选择日期时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="上传图片：" :label-width="formLabelWidth" prop="drawbackTime" class="redcolor">
          <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/"
            :on-preview="handlePreview" :on-remove="handleRemove" multiple :limit="3" :file-list="fileList">
            <el-button size="small" type="primary">点击上传</el-button>
            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
          </el-upload>
        </el-form-item>
        <el-form-item label="返款原因：" :label-width="formLabelWidth" prop="reason">
          <el-input type="textarea" :rows="3" placeholder="" maxLength="100" v-model="dialogForm.reason"
            style="width: 80%;">
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitDialogForm('dialogForm')" :disabled="confirmBtnDisabled">确 定</el-button>
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 驳回原因 -->
    <el-dialog title="驳回原因" :visible.sync="reasonDialog" v-dialog-drag>
      <div class="fs16 marginB20">{{rejectReason}}</div>
    </el-dialog>
    <!-- 返款原因 -->
    <el-dialog title="返款原因" :visible.sync="reasonDialog1" v-dialog-drag>
      <div class="fs16 marginB20">{{reason}}</div>
    </el-dialog>

    <!-- 下载图片 dialog 开始 -->
    <el-dialog title="下载图片" :visible.sync="downloadDialogVisible" width="1000px" v-dialog-drag>
      <!-- <ol>
        <li v-for="(item,index) in imgList" style="margin-bottom:8px">
          <a :href="'/financing/refund/downloadOssImg?url='+item.imgUrl" :download="item.realName"
            style="color:blue;text-decoration:underline">{{item.realName}}</a>
        </li>
      </ol> -->
      <div class="padding20" style="text-align: center;">
          <img :src="dialogFormUploadImgSrc" alt="" max-width="1000px">
          <a :href="'/financing/refund/downloadOssImg?url='+dialogFormUploadImgSrc" :download="dialogFormUploadImgName" style="color:blue;text-decoration:underline;cursor: pointer;">{{dialogFormUploadImgName}}</a>
      </div>
    </el-dialog>
    <!-- 下载图片dialog 结束 -->
    <!-- 驳回处理 -->
    <el-dialog title="提示" :visible.sync="rejectRefundDialogVisible" v-dialog-drag>
      <el-form :model="rejectRefundDialogForm" ref="rejectRefundDialogForm" :rules="rejectRefundDialogRules">
        <div class="fs16 marginB20">确定要将此 【{{sigNoTitle}}】返款申请驳回吗？</div>
        <el-form-item label="驳回原因：" label-width="100px" prop="rejectReason" class="redcolor">
          <el-input type="textarea" :rows="4" placeholder="请输入驳回原因" maxLength="100"
            v-model="rejectRefundDialogForm.rejectReason">
          </el-input>
        </el-form-item>
        <div class="f-tar">最多100字</div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitRejectRefundDialogForm('rejectRefundDialogForm')">确 定</el-button>
        <el-button @click="rejectRefundDialogVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 驳回处理结束 -->
    <!-- 付款明细 -->
    <el-dialog :title="SignNoPayDetailTitle" :visible.sync="payDetailDialogVisible" v-dialog-drag>
      <!--         <div v-show="visitRecordShow" class="fs16 marginB20">签约单编号({{curRow.signNo}})付款明细以及付款绑定到访记录</div> -->
      <div v-show="signNoShow">
        <div class="fs16 marginB20">签约单基本信息</div>
        <el-table ref="signNoTable" tooltip-effect="dark" style="width: 100%;margin-bottom: 20px;" border
          :data="signNoTable">
          <el-table-column type="index" width="50" label="序号"></el-table-column>
          <el-table-column align="center" prop="signNo" label="签约单编号"></el-table-column>
          <el-table-column align="center" prop="customerName" label="客户姓名"></el-table-column>
          <el-table-column align="center" prop="idCard" label="客户身份证号"></el-table-column>
          <el-table-column align="center" prop="phone" label="客户联系电话"></el-table-column>
          <el-table-column align="center" prop="signCompanyName" label="签约餐饮公司"></el-table-column>
          <el-table-column align="center" prop="signProjectName" label="签约项目"></el-table-column>
          <el-table-column align="center" prop="signProvince" label="签约省份"></el-table-column>
          <el-table-column align="center" prop="signCity" label="签约城市"></el-table-column>
          <el-table-column align="center" prop="signDictrict" label="签约区县"></el-table-column>
          <el-table-column align="center" prop="signShopTypeName" label="签约店型"></el-table-column>
          <el-table-column align="center" prop="amountReceivable" label="合同应收金额"></el-table-column>
          <!--<el-table-column align="center" prop="firstToll" label="路费"></el-table-column>-->
          <!--<el-table-column align="center" prop="preferentialAmount" label="招商政策优惠金额" ></el-table-column>-->
          <!--<el-table-column align="center" prop="giveAmount" label="赠送金额"></el-table-column>-->
          <el-table-column align="center" prop="signType" label="签约类型" :formatter="getSignTypeText"></el-table-column>
          <el-table-column align="center" prop="isRemoteSign" label="是否远程签约" :formatter="getIsRemoteSign">
          </el-table-column>

          <!--        <el-table-column align="center" prop="remarks" label="备注"></el-table-column> -->
        </el-table>
      </div>
      <div v-show="paymentDetailsShow">
        <div class="fs16 marginB20">全款付款明细</div>
        <el-table ref="recordTable" tooltip-effect="dark" style="width: 100%;margin-bottom: 20px;" border
          :data="recordTable">
          <el-table-column align="center" prop="statementNo" label="结算单编号" width="200"></el-table-column>
          <el-table-column align="center" prop="payName" label="付款人姓名" width="200"></el-table-column>
          <el-table-column align="center" prop="payMode" label="付款方式" :formatter="getPayModeText"></el-table-column>
          <el-table-column align="center" prop="payTime" label="付款时间" :formatter="getTimeText"></el-table-column>
          <el-table-column align="center" prop="amountReceived" label="实收金额"></el-table-column>
                <el-table-column align="center" prop="amountEquipment" label="实收设备金额" width="130"></el-table-column>
          <el-table-column align="center" prop="preferentialAmount" label="招商政策优惠金额" width="150"></el-table-column>
          <el-table-column align="center" prop="firstToll" label="路费" width="150"></el-table-column>
          <el-table-column align="center" prop="giveAmount" label="赠送金额" width="150"></el-table-column>
          <el-table-column align="center" prop="giveType" label="赠送类型" width="150" :formatter="transGiveType">
          </el-table-column>
          <el-table-column align="center" prop="amountPerformance" label="业绩金额"></el-table-column>
          <el-table-column align="center" prop="status" label="明细状态" :formatter="getStatusText"></el-table-column>
          <el-table-column align="center" prop="busGroupName" label="商务组"></el-table-column>
          <el-table-column align="center" prop="busSaleName" label="商务经理"></el-table-column>
          <el-table-column align="center" prop="remarks" label="备注"></el-table-column>
        </el-table>
      </div>
      <div v-show="paymentDetailsShow2">
        <div class="fs16 marginB20">定金付款明细</div>
        <el-table ref="recordTable2" tooltip-effect="dark" style="width: 100%;margin-bottom: 20px;" border
          :data="recordTable2">
          <el-table-column align="center" prop="statementNo" label="结算单编号" width="200"></el-table-column>
          <el-table-column align="center" prop="payName" label="付款人姓名" width="200"></el-table-column>
          <el-table-column align="center" prop="payMode" label="付款方式" :formatter="getPayModeText"></el-table-column>
          <el-table-column align="center" prop="payTime" label="付款时间" :formatter="getTimeText"></el-table-column>
          <el-table-column align="center" prop="amountReceived" label="实收金额"></el-table-column>
                <el-table-column align="center" prop="amountEquipment" label="实收设备金额" ></el-table-column>
          <el-table-column align="center" prop="preferentialAmount" label="招商政策优惠金额" width="150"></el-table-column>
          <el-table-column align="center" prop="firstToll" label="路费" width="150"></el-table-column>
          <el-table-column align="center" prop="giveAmount" label="赠送金额" width="150"></el-table-column>
          <el-table-column align="center" prop="giveType" label="赠送类型" width="150" :formatter="transGiveType">
          </el-table-column>
          <el-table-column align="center" prop="amountPerformance" label="业绩金额"></el-table-column>
          <el-table-column align="center" prop="amountBalance" label="余款金额"></el-table-column>
          <el-table-column align="center" prop="makeUpTime" label="预计余款补齐时间" :formatter="getTimeText"></el-table-column>
          <el-table-column align="center" prop="status" label="明细状态" :formatter="getStatusText"></el-table-column>
          <el-table-column align="center" prop="busGroupName" label="商务组"></el-table-column>
          <el-table-column align="center" prop="busSaleName" label="商务经理"></el-table-column>
          <el-table-column align="center" prop="remarks" label="备注"></el-table-column>
        </el-table>
      </div>
      <div v-show="paymentDetailsShow3">
        <div class="fs16 marginB20">二次定金付款明细</div>
        <el-table ref="recordTable3" tooltip-effect="dark" style="width: 100%;margin-bottom: 20px;" border
          :data="recordTable3">
          <el-table-column align="center" prop="statementNo" label="结算单编号" width="200"></el-table-column>
          <el-table-column align="center" prop="payName" label="付款人姓名" width="200"></el-table-column>
          <el-table-column align="center" prop="payMode" label="付款方式" :formatter="getPayModeText"></el-table-column>
          <el-table-column align="center" prop="payTime" label="付款时间" :formatter="getTimeText"></el-table-column>
          <el-table-column align="center" prop="amountReceived" label="实收金额"></el-table-column>
                <el-table-column align="center" prop="amountEquipment" label="实收设备金额" ></el-table-column>
          <el-table-column align="center" prop="preferentialAmount" label="招商政策优惠金额" width="150"></el-table-column>
          <el-table-column align="center" prop="firstToll" label="路费" width="150"></el-table-column>
          <el-table-column align="center" prop="giveAmount" label="赠送金额" width="150"></el-table-column>
          <el-table-column align="center" prop="giveType" label="赠送类型" width="150" :formatter="transGiveType">
          </el-table-column>
          <el-table-column align="center" prop="amountPerformance" label="业绩金额"></el-table-column>
          <el-table-column align="center" prop="amountBalance" label="余款金额"></el-table-column>
          <el-table-column align="center" prop="makeUpTime" label="预计余款补齐时间" :formatter="getTimeText"></el-table-column>
          <el-table-column align="center" prop="status" label="明细状态" :formatter="getStatusText"></el-table-column>
          <el-table-column align="center" prop="busGroupName" label="商务组"></el-table-column>
          <el-table-column align="center" prop="busSaleName" label="商务经理"></el-table-column>
          <el-table-column align="center" prop="remarks" label="备注"></el-table-column>
        </el-table>
      </div>
      <div v-show="paymentDetailsShow4">
        <div class="fs16 marginB20">尾款付款明细</div>
        <el-table ref="recordTable" tooltip-effect="dark" style="width: 100%;margin-bottom: 20px;" border
          :data="recordTable4">
          <el-table-column align="center" prop="statementNo" label="结算单编号" width="200"></el-table-column>
          <el-table-column align="center" prop="payName" label="付款人姓名" width="200"></el-table-column>
          <el-table-column align="center" prop="payMode" label="付款方式" :formatter="getPayModeText"></el-table-column>
          <el-table-column align="center" prop="payTime" label="付款时间" :formatter="getTimeText"></el-table-column>
          <el-table-column align="center" prop="amountReceived" label="实收金额"></el-table-column>
                <el-table-column align="center" prop="amountEquipment" label="实收设备金额" ></el-table-column>
          <el-table-column align="center" prop="preferentialAmount" label="招商政策优惠金额" width="150"></el-table-column>
          <el-table-column align="center" prop="firstToll" label="路费" width="150"></el-table-column>
          <el-table-column align="center" prop="giveAmount" label="赠送金额" width="150"></el-table-column>
          <el-table-column align="center" prop="giveType" label="赠送类型" width="150" :formatter="transGiveType">
          </el-table-column>
          <el-table-column align="center" prop="amountPerformance" label="业绩金额"></el-table-column>
          <el-table-column align="center" prop="status" label="明细状态" :formatter="getStatusText"></el-table-column>
          <el-table-column align="center" prop="busGroupName" label="商务组"></el-table-column>
          <el-table-column align="center" prop="busSaleName" label="商务经理"></el-table-column>
          <el-table-column align="center" prop="remarks" label="备注"></el-table-column>
        </el-table>
      </div>
    </el-dialog>
    <!-- 付款明细 -->
    <el-dialog :title="payDetailTitle" :visible.sync="recordDialog" width="870px" v-dialog-drag>
      <el-table ref="recordTableDetail" tooltip-effect="dark" style="width: 100%;margin-bottom: 20px;" border
        :data="recordTableDetail">
        <el-table-column type="index" width="50" label="序号"></el-table-column>
        <el-table-column align="center" prop="payType" label="付款类型" :formatter="transformPayType"></el-table-column>
        <el-table-column align="center" prop="statementNo" label="结算单编号" width="200"></el-table-column>
        <el-table-column align="center" prop="payName" label="付款人姓名" width="200"></el-table-column>
        <el-table-column align="center" prop="payMode" label="付款方式" :formatter="getPayModeText"></el-table-column>
        <el-table-column align="center" prop="payTime" label="付款时间" :formatter="getTimeText"></el-table-column>
        <el-table-column align="center" prop="amountReceived" label="实收金额"></el-table-column>
            <el-table-column align="center" prop="amountEquipment" label="实收设备金额" ></el-table-column>
        <el-table-column align="center" prop="preferentialAmount" label="招商政策优惠金额" width="150"></el-table-column>
        <el-table-column align="center" prop="firstToll" label="路费" width="150"></el-table-column>
        <el-table-column align="center" prop="giveAmount" label="赠送金额" width="150"></el-table-column>
        <el-table-column align="center" prop="giveType" label="赠送类型" width="150" :formatter="transGiveType">
        </el-table-column>
        <el-table-column align="center" prop="amountPerformance" label="业绩金额"></el-table-column>
        <el-table-column align="center" prop="accountStatus" label="结算状态" :formatter="transformStatus">
        </el-table-column>
        <el-table-column align="center" prop="money" label="结算金额"></el-table-column>
        <el-table-column align="center" prop="commissionMoney" label="佣金"></el-table-column>
        <el-table-column align="center" prop="busGroupName" label="商务组"></el-table-column>
        <el-table-column align="center" prop="busSaleName" label="商务经理"></el-table-column>
        <el-table-column align="center" prop="remarks" label="备注"></el-table-column>
      </el-table>
    </el-dialog>
  </div>


</body>
<!-- import Vue before Element -->
<div th:include="_footer_include :: #jsLib"></div>
<script th:src="@{/js/custom/callrecord/download.js?v=1.0.0}"></script>
<script th:inline="javascript">
  var businessLine = [[${ businessLine }]];//业务线
  var payModeItem = [[${ payModeItem }]];
  var giveTypeList = [[${ giveTypeList }]];
</script>
<script>
  var mainDivVM = new Vue({
    el: '#maindiv',
    data: function () {
      return {
        dialogFormUploadImgSrc:'',//查看图片url
        dialogFormUploadImgName:'',//查看图片名称
        isExport1:true,
        paginationShow: false,
        isShow: false,
        pager: {//pager
          total: 0,
          currentPage: 1,
          pageSize: 20,
        },
        fileList: [],
        dialogFormVisible: false,//驳回编辑
        reasonDialog: false,//驳回原因
        downloadDialogVisible: false,//下载图片dialog
        rejectReason: '',//退款原因
        reason: '',//返款原因
        reasonDialog1: false,//返款原因
        imgList: [],
        multipleSelection: [],//选择行
        editRejectTitle: '',//驳回编辑头部
        confirmBtnDisabled: false,//提交按钮 禁用
        rejectRefundDialogVisible: false,//驳回
        sigNoTitle: '',//驳回dialog title
        paymentDetailsShow: false,//判断全款付款明细表格是否显示
        paymentDetailsShow2: false,//判断定金付款明细表格是否显示
        paymentDetailsShow3: false,//判断二次定金付款明细表格是否显示
        paymentDetailsShow4: false,//判断尾款付款明细表格是否显示
        payDetailDialogVisible: false,
        signNoShow: false,
        recordTable: [],
        recordTable2: [],
        recordTable3: [],
        recordTable4: [],
        signNoTable: [],
        SignNoPayDetailTitle: '',
        payDetailTitle: '',
        rejectRefundDialogForm: {
          rejectReason: ''
        },
        rejectRefundDialogRules: {
          rejectReason: [
            { required: true, message: '请输入驳回原因', trigger: 'blur' }
          ]
        },
        form: {
          busAreaId: '',
          busGroupId: '',
          busManagerId: '',
          signProvince: '',
          signType: '',
          phone: '',
          signNo: '',
          customerName: '',
          startTime: '',
          endTime: '',
          teleDeptId: '',
          teleGroupId: '',
          teleId: ''
        },
        formLabelWidth: '150px',
        tableData: [],
        dataTable: [],
        options: [{
          value: '选项1',
          label: '黄金糕'
        }, {
          value: '选项2',
          label: '双皮奶'
        }, {
          value: '选项3',
          label: '蚵仔煎'
        }, {
          value: '选项4',
          label: '龙须面'
        }, {
          value: '选项5',
          label: '北京烤鸭'
        }],
        busAreaList: [],//商务大区
        busGroupList: [],//签单商务组
        busManagerList: [],//商务经理
        teleDeptList: [],//电销事业部
        teleGroupIdList: [],
        rejectRefundDialogVisible: false,
        teleIdList: [],
        vistitStoreTypeArr: [],//签约店型
        statusList: [
          {
            value: 1,
            name: '返款确认中'
          }, {
            value: 2,
            name: '已驳回'
          }, {
            value: 3,
            name: '确认返款'
          }, {
            value: 4,
            name: '已返款'
          }, {
            value: 5,
            name: '标记返款结束'
          }

        ],//处理状态
        proviceList: [],
        signTypeList: [{
          value: 1,
          label: '一次性全款'
        }, {
          value: 2,
          label: '先交定金'
        }],
        dialogForm: {
          cusAmount: '',
          refundTime: '',
          reason: '',
          bearAmount: ''
        },
        dialogRules: {
          reason: [
            { required: true, message: '请输入退款原因', trigger: 'blur' }
          ],
          refundTime: [
            { required: true, message: '请选择退款时间', trigger: 'blur' }
          ],
          cusAmount: [
            { required: true, message: '请输入退款客户金额', trigger: 'blur' }
          ],
          bearAmount: [
            { required: true, message: '请输入承担金额', trigger: 'blur' },
            {
              validator: function (rule, value, callback) {
                var reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g;
                if (value != null && value != "null" && value != "" && !reg.test(value)) {
                  callback(new Error("请输入数字"));
                  return;
                } else {
                  callback();
                }

              }, trigger: 'blur'
            }
          ],

        },
        amount: [{
          value: '0',
          label: '1000'
        }, {
          value: '1',
          label: '2000'
        }, {
          value: '2',
          label: '3000'
        }, {
          value: '3',
          label: '4000'
        }, {
          value: '4',
          label: '5000'
        }],
        recordTableDetail: [],//付款明细data
        recordDialog: false,//付款明细弹窗
        storeForm: {
          busAreaId: '',
          busGroupId: '',
          busManagerId: '',
          signProvince: '',
          signType: '',
          phone: '',
          signNo: '',
          customerName: '',
          startTime: '',
          endTime: '',
          teleDeptId: '',
          teleGroupId: '',
          teleId: ''
        },
        storeId: '',
        scrollTop: 0,
      }
    },
    methods: {
      //计算退款的承担金额
      allCalAmount() {
        var rows = this.multipleSelection;
        var aone = parseFloat(rows[0].ratio / 100);
        var atwo = parseFloat(this.allocationForm.cusAmount);
        if (isNaN(aone)) aone = 0
        if (isNaN(atwo)) atwo = 0
        this.allocationForm.bearAmount = (aone * atwo) + "";
      },
      submitDialogForm(formName) {//驳回提交验证
        mainDivVM.confirmBtnDisabled = true;
        this.$refs[formName].validate((valid) => {
          if (valid) {
            var param = this.dialogForm;
            axios.post('/financing/refund/editRejectRebateInfo', param)
              .then(function (response) {
                var data = response.data
                if (data.code == '0') {
                  mainDivVM.dialogFormVisible = false;
                  mainDivVM.$message({
                    message: '操作成功', type: 'success', duration: 2000, onClose: function () {
                      mainDivVM.searchTable();
                    }
                  });

                } else {
                  mainDivVM.$message({ message: '操作失败', type: 'error' });
                  console.error(data);
                }

              })
              .catch(function (error) {
                console.log(error);
              }).then(function () {
                mainDivVM.confirmBtnDisabled = false;
              });


          } else {
            console.log('error submit!!');
            mainDivVM.confirmBtnDisabled = false;
          }
        });
      },
      openSign() {//返款确认
        var rows = this.multipleSelection;
        if (rows.length == 0) {
          this.$message({
            message: '请选择数据',
            type: 'warning'
          });
          return;
        } else {
          var isPass = true;
          var idList = new Array();
          for (var i = 0; i < rows.length; i++) {
            var curRow = rows[i];
            if (curRow.status != 1) {
              this.$message({ message: '只允许操作待处理数据', type: 'warning' });
              isPass = false;
              break;
            }
            idList.push(curRow.id);
          }

          if (!isPass) {
            return;
          }



          this.$confirm('确认通过此返款申请？', '确认通过', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            var param = {};
            param.idList = idList;
            axios.post('/financing/refund/updateRebateConfirm', param)
              .then(function (response) {
                var data = response.data
                if (data.code == '0') {
                  mainDivVM.$message({
                    message: '操作成功', type: 'success', duration: 2000, onClose: function () {
                      // mainDivVM.searchTable();
                      window.location.href = '/financing/refund/rebateConfirmPage';
                    }
                  });

                } else {
                  mainDivVM.$message({ message: '操作失败', type: 'error' });
                  console.error(data);
                }

              })
              .catch(function (error) {
                console.log(error);
              }).then(function () {
              });
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消操作'
            });
          });
        }
        // 存储选中信息--start
        var clueId = rows[0].signId;
        setSessionStore("rebateConfirmStoreForm", this.storeForm);
        var otherVal = {
          "currentPage": this.pager.currentPage,
          "clueId": clueId,
          "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
        }
        setSessionStore("rebateConfirmOtherVal", otherVal);
        // 存储选中信息--end
      },
      handleSelectionChange(val) {//选择节点的事件
        this.multipleSelection = val;
      },
      searchTable() {
        var starTime = this.form.startTime;
        var endTime = this.form.endTime;
        if (endTime) {
          if (starTime > endTime) {
            this.$message({
              message: '开始时间不能大于结束时间',
              type: 'warning'
            });
            return;
          }
        }
        var param = this.form;
        param.pageNum = this.pager.currentPage;
        param.pageSize = this.pager.pageSize;
        axios.post('/financing/refund/listRebateConfirm', param)
          .then(function (response) {
            var data = response.data
            if (data.code == '0') {
              var resData = data.data;
              mainDivVM.tableData = resData.data;
              //3.分页组件
              mainDivVM.pager.total = resData.total;
              mainDivVM.pager.currentPage = resData.currentPage;
              mainDivVM.pager.pageSize = resData.pageSize;

              // 取出存储的id
              if (!mainDivVM.paginationShow) {
                if (mainDivVM.storeId) {
                  mainDivVM.$nextTick(function () {
                    var storage = [];
                    mainDivVM.tableData.forEach(function (item, index) {
                      if (item.signId === mainDivVM.storeId) {
                        storage.push(mainDivVM.tableData[index]);
                      }
                    })
                    mainDivVM.toggleSelection(storage);
                    mainDivVM.$el.querySelector('.el-table__body-wrapper').scrollTop = mainDivVM.scrollTop;
                  })
                }
              } else {
                removeSessionStore("rebateConfirmStoreForm");
                removeSessionStore("rebateConfirmOtherVal");
              }
              mainDivVM.paginationShow = true;
              mainDivVM.storeForm = mainDivVM.form;

            } else {
              mainDivVM.$message({ message: data.msg, type: 'error' });
              console.error(data);
            }

          })
          .catch(function (error) {
            console.log(error);
          }).then(function () {
          });
      },
      toggleSelection(rows) { // table select 默认选中fn
        if (rows) {
          rows.forEach(row => {
            this.$refs.tableData.toggleRowSelection(row, true);
          });
        } else {
          this.$refs.tableData.clearSelection();
        }
      },
      showReason(row) {//驳回原因
        this.rejectReason = '';
        this.reasonDialog = true
        this.rejectReason = row.rejectReason;

      },
      showReason1(row) {//返款原因
        this.reason = '';
        this.reasonDialog1 = true
        this.reason = row.reason;
      },
      editDialog(row) {//驳回编辑
        //this.dialogForm = {};

        var param = {};
        param.id = row.id;
        axios.post('/financing/refund/queryRefundInfoById', param)
          .then(function (response) {
            var result = response.data;
            if (result.code == '0') {
              var table = result.data;
              mainDivVM.dialogForm = table;
              var imgList = table.imgList;
              var imgShowList = new Array();
              for (var i = 0; i < imgList.length; i++) {
                var curImg = imgList[i];
                var img = {};
                img.name = "上传文件" + (i + 1);
                img.url = curImg.imgUrl;
                img.id = curImg.id;
                imgShowList.push(img);
              }
              mainDivVM.editRejectTitle = "编辑驳回（" + table.signNo + "）签约单返款申请";
              mainDivVM.fileList = imgShowList;
              mainDivVM.dialogFormVisible = true;
            } else {
              console.error(response);
            }

          })
          .catch(function (error) {
            console.log(error);
          });

      },
      handlePreview(file) {

      },
      handleRemove(file, fileList) {
        var param = {};
        var idList = new Array();
        idList.push(file.id)
        param.idList = idList;
        axios.post('/financing/refund/deleteImgByIdList', param)
          .then(function (response) {
            var result = response.data;
            if (result.code == '0') {
              mainDivVM.$message({ message: '删除成功', type: 'success' });
            } else {
              console.error(response);
              mainDivVM.$message({ message: result.msg, type: 'error' });
            }

          })
          .catch(function (error) {
            console.log(error);
          });

      },
      initSelect() {
        this.initBusAreaSelect();
        this.initSignShopTypeSelect();
        this.initSignProvinceSelect();
        this.initTeleDeptId();
      },
      initBusAreaSelect() {//商务大区下拉框
        axios.post('/organization/organization/queryBusinessAreaList?businessLine=' + businessLine, {})
          .then(function (response) {
            var result = response.data;
            if (result.code == '0') {
              var table = result.data;
              mainDivVM.busAreaList = table;
            } else {
              console.error(response);
            }

          })
          .catch(function (error) {
            console.log(error);
          });
      },
      changeBusArea(selectedValue) {//改变商务大区
        console.info(selectedValue);
        this.clearBusAreaList();
        if (!selectedValue) {
          return;
        }
        var param = {};
        param.id = selectedValue;
        axios.post('/organization/organization/queryBusGroupListByParentId', param)
          .then(function (response) {
            var result = response.data;
            var table = result.data;
            mainDivVM.busGroupList = table;
          })
          .catch(function (error) {
            console.log(error);
          });
      },
      changeBusGroup(selectedValue) {//改变商务组
        this.clearBusGroupList();
        if (!selectedValue) {
          return;
        }
        var param = {};
        param.id = selectedValue;
        axios.post('/organization/organization/queryBusManagerByOrgId', param)
          .then(function (response) {
            var result = response.data;
            var table = result.data;
            mainDivVM.busManagerList = table;
          })
          .catch(function (error) {
            console.log(error);
          });
      },
      clearBusAreaList() {
        this.busGroupList = [];
        this.form.busGroupId = '';
        this.clearBusGroupList();

      },
      clearBusGroupList() {
        this.busManagerList = [];
        this.form.busManagerId = '';
      },
      initSignShopTypeSelect() {//签约店型
        var param = {};
        param.groupCode = "vistitStoreType";
        axios.post('/dictionary/DictionaryItem/dicItemsByGroupCode', param).then(function (response) {
          mainDivVM.vistitStoreTypeArr = response.data.data;
        });
      },
      initSignProvinceSelect() {
        axios.post('/visit/visitRecord/getSignProvince', {})
          .then(function (response) {
            var result = response.data;
            if (result.code == '0') {
              var table = result.data;
              mainDivVM.proviceList = table;
            } else {
              console.error(response);
            }

          })
          .catch(function (error) {
            console.log(error);
          });
      },
      getSignShopTypeText(row, column, value, index) {
        var valText = "";
        if (value == 1) {
          valText = "旗舰店";
        } else if (value == 2) {
          valText = "创业店";
        } else if (value == 3) {
          valText = "标准店";
        } else if (value == 5) {
          valText = "区域代理";
        } else if (value == 6) {
          valText = "单技术";
        }
        return valText;
      },
      getIsRemoteSign(row, column, value, index) {
        var valText = "";
        if (value == 0) {
          valText = "否";
        } else if (value == 1) {
          valText = "是";
        }
        return valText;
      },
      download(row,index) {//打开弹窗下载图片
          this.downloadDialogVisible = true;
          // 给弹窗图片地址和名称赋值
          this.dialogFormUploadImgSrc=row[index].imgUrl;
          this.dialogFormUploadImgName=row[index].realName;
        // this.downloadDialogVisible = true;
        // var id = row.id;
        // var param = {};
        // param.id = id;
        // axios.post('/financing/refund/listImgById', param)
        //   .then(function (response) {
        //     var resData = response.data;
        //     if (resData.code == '0') {
        //       mainDivVM.imgList = resData.data;
        //     } else {
        //       mainDivVM.$message({ message: '查询图片失败', type: 'error' });
        //       console.error(resData);
        //     }

        //   })
        //   .catch(function (error) {
        //     console.log(error);
        //   }).then(function () {

        //   });
      },
      downloadImg(url, index) {
        var urlArr = url.split(".");
        //download(url, "上传图片"+(index+1)+"."+urlArr[urlArr.length-1], "image/*");
        /*  var x=new XMLHttpRequest();
            x.open("GET", url, true);
            x.responseType = 'blob';
            x.onload=function(e){
                download(x.response, "上传图片"+(index+1)+"."+urlArr[urlArr.length-1], "image/*");
                }
            x.send(); */

      },
      initTeleDeptId() {//电销事业部
        axios.post('/organization/organization/queryTeleDeptList?businessLine=' + businessLine, {})
          .then(function (response) {
            var result = response.data;
            if (result.code == '0') {
              var table = result.data;
              mainDivVM.teleDeptList = table;
            } else {
              console.error(response);
            }

          })
          .catch(function (error) {
            console.log(error);
          });
      },
      changeTeleDept(selectedValue) {//电销事业部
        this.clearTeleDeptList();
        if (!selectedValue) {
          return;
        }
        var param = {};
        param.id = selectedValue;
        axios.post('/organization/organization/queryTeleGroupListByParentId', param)
          .then(function (response) {
            var result = response.data;
            var table = result.data;
            mainDivVM.teleGroupIdList = table;
          })
          .catch(function (error) {
            console.log(error);
          });
      },
      changeTeleGroup(selectedValue) {//改变电销组
        this.clearTeleGroupList();
        if (!selectedValue) {
          return;
        }
        var param = {};
        param.id = selectedValue;
        axios.post('/organization/organization/queryTeleSaleByOrgId', param)
          .then(function (response) {
            var result = response.data;
            var table = result.data;
            mainDivVM.teleIdList = table;
          })
          .catch(function (error) {
            console.log(error);
          });
      },
      clearTeleDeptList() {
        this.teleGroupIdList = [];
        this.form.teleGroupId = '';
        this.clearTeleGroupList();

      },
      clearTeleGroupList() {
        this.teleIdList = [];
        this.form.teleId = '';
      },
      openRejectRefundDialog() {//驳回返款
        var rows = this.multipleSelection;
        if (rows.length == 0) {
          this.$message({
            message: '请选择数据',
            type: 'warning'
          });
          return;
        } else {
          var isPass = true;
          var titleArr = new Array();
          for (var i = 0; i < rows.length; i++) {
            var curRow = rows[i];
            if (curRow.status != 1) {
              this.$message({ message: '只允许操作待处理数据', type: 'warning' });
              isPass = false;
              break;
            }
            titleArr.push(curRow.signNo);
          }

          if (!isPass) {
            return;
          }

          this.sigNoTitle = titleArr.join("，");
          this.rejectRefundDialogForm.rejectReason = '';
          this.rejectRefundDialogVisible = true;
        }
      },
      submitRejectRefundDialogForm(formName) {//提交驳回原因
        var rows = this.multipleSelection;
        this.$refs[formName].validate((valid) => {
          if (valid) {
            var param = {};
            var rows = this.multipleSelection;
            if (rows.length == 0) {
              this.$message({ message: '请选择数据', type: 'warning' });
              return;
            }
            var idArr = new Array();
            var isPass = true;
            for (var i = 0; i < rows.length; i++) {
              var curRow = rows[i];
              if (curRow.status != 1) {
                this.$message({ message: '只允许操作待处理数据', type: 'warning' });
                isPass = false;
                break;
              }
              idArr.push(curRow.id);
            }
            if (!isPass) {
              return;
            }


            param.idList = idArr;
            param.rebutReason = this.rejectRefundDialogForm.rejectReason;
            axios.post('/financing/refund/rejectRebate', param)
              .then(function (response) {
                var resData = response.data;
                if (resData.code == '0') {
                  mainDivVM.rejectRefundDialogForm.rejectReason = '';
                  mainDivVM.rejectRefundDialogVisible = false;
                  mainDivVM.$message({
                    message: '操作成功', type: 'success', duration: 2000, onClose: function () {
                      // mainDivVM.searchTable();
                      window.location.href = '/financing/refund/rebateConfirmPage';
                    }
                  });
                } else {
                  mainDivVM.$message({ message: resData.msg, type: 'error' });
                  console.error(resData);
                }

              })
              .catch(function (error) {
                console.log(error);
              }).then(function () {
              });


          } else {
            console.log('error submit!!');
            return false;
          }
        });
        // 存储选中信息--start
        var clueId = rows[0].signId;
        setSessionStore("rebateConfirmStoreForm", this.storeForm);
        var otherVal = {
          "currentPage": this.pager.currentPage,
          "clueId": clueId,
          "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
        }
        setSessionStore("rebateConfirmOtherVal", otherVal);
        // 存储选中信息--end
      },
      openMarkRefundDialog() {
        var rows = this.multipleSelection;
        if (rows.length == 0) {
          this.$message({
            message: '请选择数据',
            type: 'warning'
          });
          return;
        } else {
          var isPass = true;
          var idList = new Array();
          for (var i = 0; i < rows.length; i++) {
            var curRow = rows[i];
            if (curRow.status != 3) {
              this.$message({ message: '只允许操作返款确认数据', type: 'warning' });
              isPass = false;
              break;
            }
            idList.push(curRow.id);
          }

          if (!isPass) {
            return;
          }

          this.$confirm('确认标记为已返款吗？', '确认通过', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            var param = {};
            param.idList = idList;
            axios.post('/financing/refund/markRebate', param)
              .then(function (response) {
                var data = response.data
                if (data.code == '0') {
                  mainDivVM.$message({
                    message: '操作成功', type: 'success', duration: 2000, onClose: function () {
                      // mainDivVM.searchTable();
                      window.location.href = '/financing/refund/rebateConfirmPage';
                    }
                  });

                } else {
                  mainDivVM.$message({ message: '操作失败', type: 'error' });
                  console.error(data);
                }

              })
              .catch(function (error) {
                console.log(error);
              }).then(function () {
              });

          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消操作'
            });
          });
        }
        // 存储选中信息--start
        var clueId = rows[0].signId;
        setSessionStore("rebateConfirmStoreForm", this.storeForm);
        var otherVal = {
          "currentPage": this.pager.currentPage,
          "clueId": clueId,
          "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
        }
        setSessionStore("rebateConfirmOtherVal", otherVal);
        // 存储选中信息--end
      },
      openSignDialog(signNo) {//查看签约单
        this.paymentDetailsShow = false;
        this.paymentDetailsShow2 = false;
        this.paymentDetailsShow3 = false;
        this.paymentDetailsShow4 = false;
        this.SignNoPayDetailTitle = "(" + signNo + ") 签约单详情";
        this.payDetailDialogVisible = true;
        var param = {};
        param.signNo = signNo;
        axios.post('/financing/refund/querySignInfoBySignNo', param)
          .then(function (response) {
            var resData = response.data;
            if (resData.code == '0') {
              // debugger;
              var data = resData.data;
              //签约单信息
              var signNo = data.sign;
              mainDivVM.signNoTable = signNo;
              mainDivVM.signNoShow = true;
              var payDetailData = data.payDetailMap;
              if (payDetailData) {
                if (payDetailData[1]) {
                  mainDivVM.paymentDetailsShow = true;
                  mainDivVM.recordTable = payDetailData[1];
                }
                if (payDetailData[2]) {
                  mainDivVM.paymentDetailsShow2 = true;
                  mainDivVM.recordTable2 = payDetailData[2];
                }
                if (payDetailData[3]) {
                  mainDivVM.paymentDetailsShow3 = true;
                  mainDivVM.recordTable3 = payDetailData[3];
                }
                if (payDetailData[4]) {
                  mainDivVM.paymentDetailsShow4 = true;
                  mainDivVM.recordTable4 = payDetailData[4];
                }
              }



            } else {
              mainDivVM.$message({ message: resData.msg, type: 'error' });
              console.error(resData);
            }

          })
          .catch(function (error) {
            console.log(error);
          }).then(function () {
          });

      },
      toSignPage(row) {  // 进入签约单明细  能够 新增付款
        window.location.href = '/businesssign/visitRecordPage?readyOnly=1&showSignButton=1&clueId=' + row.clueId + "&signId=" + row.signId;
      },
      getSignTypeText(row, column, value, index) {
        var valText = "";
        if (value == 1) {
          valText = "一次性全款";
        } else if (value == 2) {
          valText = "先交定金";
        }
        return valText;
      },
      getPayModeText(row, column, value, index) {
        var valText = "";
        if (!value) {
          return valText;
        }
        var vals = value.split(",");
        if (payModeItem) {
          for (var j = 0; j < vals.length; j++) {
            for (var i = 0; i < payModeItem.length; i++) {
              if (payModeItem[i].value == vals[j]) {
                if (j == 0) {
                  valText += payModeItem[i].name;
                } else {
                  valText += "," + payModeItem[i].name;
                }

              }
            }
          }
        }
        return valText;
      },
      transGiveType(row, column, value, index) {
        var text = "";
        for (var i = 0; i < giveTypeList.length; i++) {
          if (giveTypeList[i].value == value) {
            text = giveTypeList[i].name;
          }
        }
        return text;
      },

      getStatusText(row, column, value, index) {
        var valText = "";
        if (value == 0) {
          valText = "驳回";
        }
        else if (value == 1) {
          valText = "审核中";
        } else if (value == 2) {
          valText = "有效";
        }
        return valText;
      },
      getTimeText(row, column, value, index) {
        var valText = "";
        if (value) {
          valText = moment(Number(value)).format("YYYY-MM-DD HH:mm:ss");
          //valText =  moment.unix(Number(value)).format("YYYY-MM-DD HH:mm:ss");
        }
        return valText;
      },
      recordClick(row) {//查看明细
        // row.signNo;
        var signNo = row.signNo;
        this.payDetailTitle = "(" + signNo + ") 付款明细";
        var param = {};
        param.idList = [row.signId];
        axios.post('/sign/signRecord/listPayDetail', param)
          .then(function (response) {
            var resData = response.data;
            console.log(resData.data)
            if (resData.code == '0') {
              mainDivVM.recordTableDetail = resData.data;
            } else {
              mainDivVM.$message({ message: resData.msg, type: 'error' });
              console.error(resData);
            }
            mainDivVM.recordDialog = true;
          })
          .catch(function (error) {
            console.log(error);
          }).then(function () {
          });

      },
      //付款类型转换方法
      transformPayType(row, column, cellValue, index) {
        var text = "";
        if (cellValue == "1") {
          text = "全款"
        } else if (cellValue == "2") {
          text = "定金"
        } else if (cellValue == "3") {
          text = "追加定金"
        } else if (cellValue == "4") {
          text = "尾款"
        }
        return text;
      },
      //处理状态转换方法
      transformStatus(row, column, cellValue, index) {
        var text = "";
        if (cellValue == "0") {
          text = "待处理";
        } else if (cellValue == "1") {
          text = "驳回";
        } else if (cellValue == "2") {
          text = "提交对账";
        } else if (cellValue == "3") {
          text = "已对账";
        } else if (cellValue == "4") {
          text = "已结算";
        }
        return text;
      },
      toogleClick() {
        if (this.isShow) {
          this.isShow = false
        } else {
          this.isShow = true
        }
      },



      exportMes(){
        var starTime = this.form.startTime;
        var endTime = this.form.endTime;
        if (endTime) {
          if (starTime > endTime) {
            this.$message({
              message: '开始时间不能大于结束时间',
              type: 'warning'
            });
            return;
          }
        }
        var param = this.form;
        param.pageNum = null;
        param.pageSize = null;
        axios.post('/financing/refund/listRebateApplyExport',param,{responseType:'blob'})
                .then(function (response) {
                  var data =  response.data;
                  var fileName = response.headers.filename;
                  saveAs(data,decodeURI(fileName));
                  mainDivVM.$notify({
                    type: 'success',
                    title: '提示',
                    message: '退款导出下载完成',
                    position: 'bottom-right',
                    duration: 0
                  });
                  localStorage.removeItem("distributeExport1");
                }).catch(function (error) {
          console.log(error);
          mainDivVM.$notify.error({
            title: '提示',
            message: error + ',退款导出失败',
            position: 'bottom-right'
          });
          localStorage.removeItem("distributeExport1");
        }).then(function(){
        });
      },




    },
    created() {
      // 进入页面判断有是否有存储值
      if (!this.paginationShow) {
        var storeVal = getSessionStore("rebateConfirmStoreForm");
        var otherVal = getSessionStore("rebateConfirmOtherVal");
        if (storeVal && otherVal) {
          this.form = storeVal;
          this.$set(this.pager, "currentPage", otherVal.currentPage);
          this.storeId = otherVal.clueId;
          this.scrollTop = otherVal.scrollTop;
        }
      };
      // 取页数存储
      var localVal = localStorage.getItem('allChangePageSize') ? parseInt(localStorage.getItem('allChangePageSize')) : '';
      if (localVal) { this.pager.pageSize = localVal; }
      this.searchTable();
      this.initSelect();
    },
    mounted() {
      document.getElementById('maindiv').style.display = 'block';
    }
  })
</script>

</html>